﻿using System.Globalization;
using System.Net.Http;
using CkSoftware.GroupMe.Sdk.Core;
using CkSoftware.GroupMe.Sdk.Core.Dao;

namespace CkSoftware.GroupMe.Sdk.Messaging.Commands
{
	/// <summary>
	/// Message unlike command (GroupMe documentation: <see href="https://dev.groupme.com/docs/v3#likes_destroy" />).
	/// </summary>
	public class MessageUnlikeCommand : IWebApiCommand<GroupMeApiResponse<EmptyResponse>>
	{
		private const string CommandNameFormat = "messages/{0}/{1}/unlike";

		private readonly string _conversationId;

		private readonly string _messageId;

		/// <summary>
		/// Creates a new Message Unlike command.
		/// </summary>
		/// <param name="conversationId">The Id of the parent conversation (can be a group-id or a user-id).</param>
		/// <param name="messageId">The id of the message to unlike.</param>
		public MessageUnlikeCommand(string conversationId, string messageId)
		{
			_conversationId = conversationId;
			_messageId = messageId;
		}

		/// <summary>
		/// Defines if the command is executed once.
		/// </summary>
		public bool CommandExecuted { get; set; }

		/// <summary>
		/// The name of the command to be executed.
		/// </summary>
		public string CommandName
		{
			get { return string.Format(CultureInfo.CurrentCulture, CommandNameFormat, _conversationId, _messageId); }
		}

		/// <summary>
		/// The http method to execute this command.
		/// </summary>
		public HttpMethod HttpMethod
		{
			get { return HttpMethod.Post; }
		}

		/// <summary>
		/// The parameters which should be used on command execution.
		/// </summary>
		public IWebApiCommandParameters Parameters
		{
			get { return null; }
		}
	}
}